package com.lechuang.member.manager.Impl;

import com.lechuang.member.entity.MemberLevel;
import com.lechuang.member.manager.MemberLevelManager;
import com.lechuang.member.service.MemberLevelService;
import com.lechuang.member.vo.MemberLevelVo;
import jakarta.annotation.Resource;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author apple
 * @version 1.0
 * @date 2024/6/22
 */
@Service
@Log4j2
public class MemberLevelManagerImpl implements MemberLevelManager {

    @Resource
    private MemberLevelService memberLevelService;

    @Override
    public List<MemberLevelVo> list() {
        List<MemberLevelVo> memberLevelVoList =new ArrayList<MemberLevelVo>();
        List<MemberLevel> memberLevelList = memberLevelService.list();
        memberLevelList.forEach(bean->{
            MemberLevelVo memberLevelVo = new MemberLevelVo();
            memberLevelVo.setId(bean.getId());
            memberLevelVo.setName(bean.getName());
            memberLevelVoList.add(memberLevelVo);
        });
        return memberLevelVoList;
    }
}
